c++ “undefined reference to xxx“, “collect2.exe: error: ld returned 1 exit status“

您所在的位置:网站首页 undefined reference to winmain c++ “undefined reference to xxx“, “collect2.exe: error: ld returned 1 exit status“

c++ “undefined reference to xxx“, “collect2.exe: error: ld returned 1 exit status“

#c++ “undefined reference to xxx“, “collect2.exe: error: ld returned 1 exit status“| 来源: 网络整理| 查看: 265

背景

在学习c++设计模式的Pimpl时,一共编写了三个文件:try.h、try.cpp和test.cpp,其中主函数包含在test.cpp中,并在该文件中调用try.h头文件中自定义的类;try.h中的具体实现细节被封装在try.cpp中。

//try.h class Line { public: Line(int x1, int y1, int x2, int y2); ~Line(); void printLine() const; private: class LineImpl; LineImpl *_pimpl; }; //try.cpp #include #include"try.h" using namespace std; class Line::LineImpl { public: LineImpl(int x1, int y1, int x2, int y2); void printLineImpl() const; private: class Point { public: Point(int x=-1, int y=2) :_x(x) ,_y(y) { cout


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3